<script src="{{ .Site.BaseURL }}js/jquery.min.js"></script>
{{ $versionArr := split $.File.Path "docs/" }}
{{ $version := index $versionArr 1}}
{{ $version := split $version "/" }}
{{ $version := index $version 0}}
{{ $lang := .Site.LanguageCode}}
<div class="docsVersion isPc">
    <div class="row" >
        <select id="version" class="selectVersion col-xs-7 ">
            {{ range .Site.Data.docsVersion }}
            {{ if eq $lang "zh-cn" }}
            <option link="{{.defaultUrlZh}}">{{.version}}</option>
            {{ else }}
            <option link="{{.defaultUrlEn}}">{{.version}}</option>
            {{ end }}
            {{ end }}
        </select>
        <div class="download_btn col-xs-5 " style="padding-right:0;">
            {{ range .Site.Data.docsVersion }}
            {{ if eq $version .version}}
            {{ if eq $lang "zh-cn" }}
            <a id="downloadLink" href="{{ .downloadUrlZh }}"><i class="download_icon"></i>{{ i18n "download_download" }}</a>
            {{ else }}
            <a id="downloadLink" href="{{ .downloadUrlEn }}"><i class="download_icon"></i>{{ i18n "download_download" }}</a>
            {{ end }}
            {{ end }}
            {{ end }}
        </div>
    </div>
</div>
<script>
//版本下拉框切换事件
$('#version').change(function(){
  var optionCheck = $('#version').find("option:checked");
  window.location.href=optionCheck.attr('link');
})
</script>